<?php
/* @var $this JamaahController */
/* @var $model Jamaah */
/* @var $form CActiveForm */
$isnew = $model->isNewRecord;
$request = Yii::app()->request;
if ($request->enableCsrfValidation) {
    echo CHtml::metaTag($request->getCsrfToken(), 'csrf-token');
    echo CHtml::metaTag($request->csrfTokenName, 'csrf-param');
}
?>

<div class="form">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'jamaah-form',
        'enableAjaxValidation' => false,));
    ?>

    <?php
    $fotoImage = sha1(uniqid() . 'FOTO' . Now('yyyyMMddhhmmss'));
    echo CHtml::hiddenField('image_name_tmp', $fotoImage);
    $ktpImage = sha1(uniqid() . 'KTP' . Now('yyyyMMddhhmmss'));
    echo CHtml::hiddenField('ktp_tmp', $ktpImage);
    ?>




    <?php echo $form->errorSummary($model); ?>

    <table border="0" style="margin: 10px 0px;">
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>File Foto</b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel">
                    :
                </div>
            </td>
            <td class="idform">
                <div id="cropFoto"><?php
                    echo $model->isNewRecord ? "" :
                            "<img id='image' src='" . bu() . '/img/jamaah/foto/' . $model->id_laskar . '.jpg' .
                            "' style=\"width: 100px; height: 100px; margin-left: 0px; margin-bottom: 10px;\">";
                    ?></div>
                <?php
                $this->widget('ext.EAjaxUpload.EAjaxUpload', array(
                    'id' => 'uploadFileFoto',
                    'postParams' => array('tmp' => $fotoImage),
                    'config' => array(
                        'action' => url('jamaah/upload'),
                        'allowedExtensions' => array("jpg", "jpeg", "gif", "png"),
                        //array("jpg","jpeg","gif","exe","mov" and etc...
                        'sizeLimit' => 500 * 1024,
                        // maximum file size in bytes       //$('#cropDialog').dialog('open');
                        'minSizeLimit' => 10,
                        //*1024*1024,// minimum file size in bytes $('.qq-upload-button').css('display', 'none');
                        'onComplete' => "js:function(id, fileName, responseJSON){
                                        $('#uploadFileFoto').hide();
                                        if (responseJSON.success) {
                                                $('#cropFoto').load('" . Url('jamaah/cropFoto') . "/'+responseJSON.filename);
                                                $('#Users_image').val(responseJSON.filename);
                                                $('#Users_imageExt').val((responseJSON.filename.substring(responseJSON.filename.lastIndexOf('.'))).toLowerCase());
                                                $('#uploadFileFoto').show();
                                        } else {
                                                $('#uploadFileFoto').html('<p  width=\"160\">' + responseJSON.error +'</p>');
                                        }
                                }",
                        'messages' => array(
                            'typeError' => "{file} has invalid extension. Only {extensions} are allowed.",
                            'sizeError' => "{file} is too large, maximum file size is {sizeLimit}.",
                            'minSizeError' => "{file} is too small, minimum file size is {minSizeLimit}.",
                            'emptyError' => "{file} is empty, please select files again without it.",
                            'onLeave' => "The files are being uploaded, if you leave now the upload will be cancelled."),
                        'showMessage' => "js:function(message){ alert(message); }")));
                ?>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>File KTP</b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel">
                    :
                </div>
            </td>
            <td class="idform">
                <div id="cropKtp"><?php
                    echo $model->isNewRecord ? "" :
                            "<img id='image' src='" . bu() . '/img/jamaah/ktp/' . $model->id_laskar . '.jpg' .
                            "' style=\"width: 100px; height: 100px; margin-left: 0px; margin-bottom: 10px;\">";
                    ?></div>
                <?php
                $this->widget('ext.EAjaxUpload.EAjaxUpload', array(
                    'id' => 'uploadFile',
                    'postParams' => array('tmp' => $ktpImage),
                    'config' => array(
                        'action' => url('jamaah/upload'),
                        'allowedExtensions' => array("jpg", "jpeg", "gif", "png"),
                        //array("jpg","jpeg","gif","exe","mov" and etc...
                        'sizeLimit' => 500 * 1024,
                        // maximum file size in bytes       //$('#cropDialog').dialog('open');
                        'minSizeLimit' => 10,
                        //*1024*1024,// minimum file size in bytes $('.qq-upload-button').css('display', 'none');
                        'onComplete' => "js:function(id, fileName, responseJSON){
                                        $('#uploadFile').hide();
                                        if (responseJSON.success) {
                                                $('#cropKtp').load('" . Url('jamaah/cropktp') . "/'+responseJSON.filename);
                                                $('#Users_image').val(responseJSON.filename);
                                                $('#Users_imageExt').val((responseJSON.filename.substring(responseJSON.filename.lastIndexOf('.'))).toLowerCase());
                                                $('#uploadFile').show();
                                        } else {
                                                $('#uploadFile').html('<p  width=\"160\">' + responseJSON.error +'</p>');
                                        }
                                }",
                        'messages' => array(
                            'typeError' => "{file} has invalid extension. Only {extensions} are allowed.",
                            'sizeError' => "{file} is too large, maximum file size is {sizeLimit}.",
                            'minSizeError' => "{file} is too small, minimum file size is {minSizeLimit}.",
                            'emptyError' => "{file} is empty, please select files again without it.",
                            'onLeave' => "The files are being uploaded, if you leave now the upload will be cancelled."),
                        'showMessage' => "js:function(message){ alert(message); }")));
                ?>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'nama'); ?>
                    </b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top"><?php echo $form->textField($model, 'nama', array('size' => 60, 'maxlength' => 255)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'alamat_ktp'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top"><?php echo $form->textArea($model, 'alamat_ktp', array('rows' => 6, 'cols' => 50)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'tgl_lahir'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">
                <?php
                // echo $form->textField($model,'tgl_lahir');
                $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                    'model' => $model,
                    'attribute' => 'tgl_lahir',
                    // additional javascript options for the date picker plugin
                    'options' => array(
                        'showAnim' => 'fold',
                        'changeMonth' => true,
                        'changeYear' => true,
                        'gotoCurrent' => true,
                        'dateFormat' => "dd-mm-yy"),
                    'htmlOptions' => array(
                        'size' => 20,
                        'maxlength' => 50,
                        'readonly' => 'readonly'),));
                ?>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'tempat_lahir'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'tempat_lahir', array('size' => 60, 'maxlength' => 255));
                ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'hp1'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top"><?php echo $form->textField($model, 'hp1', array('size' => 20, 'maxlength' => 20)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'hp2'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top"><?php echo $form->textField($model, 'hp2', array('size' => 20, 'maxlength' => 20)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'tlp_rumah'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'tlp_rumah', array('size' => 20, 'maxlength' => 20));
                ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'pin_bb'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'pin_bb', array('size' => 20, 'maxlength' => 20)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'email'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'email', array('size' => 50, 'maxlength' => 50)); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'no_ktp'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'no_ktp', array('size' => 60, 'maxlength' => 255)); ?></td>
        </tr>

        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'sadziliyah'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top"><?php echo $form->radioButtonList($model, 'sadziliyah', array(0 => 'Belum', 1 => 'Sudah')); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'qodiriyah'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'qodiriyah', array(0 => 'Belum', 1 => 'Sudah'));
                ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'lama_suluk'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->textField($model, 'lama_suluk'); ?> Hari</td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'id_kelompok'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td class="idform">
                <?php echo $form->hiddenField($model, 'id_kelompok'); ?>
                <?php
                $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                    'name' => 'id_kelompok_auto',
                    'source' => url('jamaah/getlistkelompok'),
                    'value' =>
                    $isnew || $model->id_kelompok == null || $model->id_kelompok == '' ? '' : u::get_model_by_id('kelompok', $model->id_kelompok)->nama_kelompok,
                    'options' => array(
                        'showAnim' => 'fold',
                        'select' =>
                        'js:function(event, ui){ jQuery("#' . CHtml::activeId($model, 'id_kelompok') . '").val(ui.item["id"]); }'),
                    'htmlOptions' => array('size' => '60')));
                ?>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'sa78'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'sa78', array(0 => 'Belum', 1 => 'Sudah')); ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b><?php echo $form->labelEx($model, 'laqodja'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'laqodja', array(0 => 'Belum', 1 => 'Sudah'));
                ?></td>
        </tr>
            <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'jenis kelamin'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'jenis_kelamin', array(0 => 'Pria', 1 => 'Wanita'));
                ?></td>
        </tr>
        <tr>
            <td valign="top">
                <div class="tamuisianlabel"><b>    <?php echo $form->labelEx($model, 'status'); ?></b></div>
            </td>
            <td valign="top">
                <div class="tamuisianlabel"><b>:</b></div>
            </td>
            <td valign="top">    <?php echo $form->radioButtonList($model, 'status', array(0 => 'Non Aktif', 1 => 'Aktif'));
                ?></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>   <?php echo CHtml::submitButton($model->isNewRecord ? 'Buat' : 'Simpan', array('class' => 'form-submit')); ?></td>
        </tr>
    </table>




    <?php $this->endWidget(); ?>
</div><!-- form -->